import { RouteConfig } from 'vue-router'
import autoRoutes from './autoRoutes'

let fromAutoRoutes = autoRoutes

function load (component: string) {
    return () => import(`@/components/${component}.vue`)
}

const routes: RouteConfig[] = [
    {
        path: '',
        component: load('main/layout'),
        children: [
            { path: '', component: load('content/layout') },
            { path: 'config', component: load('config/layout') },
            ...fromAutoRoutes
        ]
    },
    { path: '*', component: load('Error404') }
]

export default routes
